#include "friendnotificationitem.h"
#include "ui_friendnotificationitem.h"

#include <QDebug>

FriendNotificationItem::FriendNotificationItem(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::FriendNotificationItem)
{
    ui->setupUi(this);
}

FriendNotificationItem::~FriendNotificationItem()
{
    delete ui;
}

QString FriendNotificationItem::username() const
{
    return m_username;
}

void FriendNotificationItem::setUsername(const QString &newUsername)
{
    ui->label_username->setText(newUsername);
    m_username = newUsername;
}

void FriendNotificationItem::setType(QString type)
{
    ui->label_type->setText(type);
}

void FriendNotificationItem::setTimestamp(QDateTime timestamp)
{
    ui->label_timestamp->setText(timestamp.toString("yy/M/d h:mm"));
}

void FriendNotificationItem::on_pushButton_agree_clicked()
{
    qDebug() << __FILE__ << __LINE__ << __FUNCTION__ <<"m_fromId =" << m_fromId;
    emit signal_agreeFriendRequest(m_fromId);
}

QString FriendNotificationItem::fromId() const
{
    return m_fromId;
}

void FriendNotificationItem::setFromId(const QString &newFromId)
{
    m_fromId = newFromId;
}

